{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "from sympy import *\n",
    "from sympy.abc import *\n",
    "from sympy import sin, cos, pi\n",
    "import numpy as np\n",
    "from IPython.display import display, Math\n",
    "from handcalcs import *\n",
    "from sympy.physics.hydrogen import*\n",
    "f,g,T,V,T= symbols('f g x v t', cls=Function)\n",
    "w_0,w_1,w_2,v_0,v_1,J_0,J_1,J_A,J_B,m_1,m_2,J_2,w,phi,w_1,phi_1,w_2,phi_2= symbols('w_0 w_1 w_2 v_0 v_1,J_0,J_1,J_A,J_B,m_1,m_2,J_2,omega,varphi,omega_1,varphi_1,omega_2,varphi_2')\n",
    "beta=symbols('beta')\n",
    "def out(x,x_1=0,x_2=0,x_3=0,x_4=0,x_5=0,x_6=0,x_7=0,x_8=0,x_9=0,x_10=0,x_11=0):\n",
    "   if x==0:\n",
    "      return\n",
    "   if x_1==0:\n",
    "       display(Math(latex(x)))\n",
    "   else:\n",
    "       if type(x_1)==str:\n",
    "          display(Math(x_1+latex(x)))\n",
    "       else:\n",
    "           display(Math(latex(x)))\n",
    "   out(x_2,x_3)\n",
    "   out(x_4,x_5)\n",
    "   out(x_6,x_7)\n",
    "   out(x_8,x_9)\n",
    "   out(x_10,x_11)\n",
    "def tex(x):\n",
    "   print(latex(x))\n",
    "def r1(x,y):\n",
    "   return Rational(x,y) "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "$w_1-w_0=\\frac{\\beta t^{2}}{2} + t w_{0}$,转：$rev$"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##### `单摆和复摆`\n",
    "$$w=\\sqrt{\\frac{mgl}{J}}=\\sqrt{\\frac{g}{l}}$$"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##### `简谐振动的能量`\n",
    "$$E_k=\\frac{1}{2}mv^2=\\frac{A^{2} m \\omega^{2} \\sin^{2}{\\left(\\omega t + \\varphi \\right)}}{2}$$\n",
    "$$E_p=\\int\\limits_{0}^{x} \\left(- k x\\right)\\, dx = - \\frac{k x^{2}}{2}=\\frac{A^{2} k \\cos^{2}{\\left(\\omega t + \\varphi \\right)}}{2}$$\n",
    "$$E=\\frac{A^{2} k \\cos^{2}{\\left(\\omega t + \\varphi \\right)}}{2} + \\frac{A^{2} m \\omega^{2} \\sin^{2}{\\left(\\omega t + \\varphi \\right)}}{2}=\\frac{ kA^{2}}{2}$$"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "1.2"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "a=1.2\n",
    "b=2.4\n",
    "r=1.2\n",
    "(b-a)/a*r"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "ename": "SyntaxError",
     "evalue": "invalid syntax (Temp/ipykernel_14840/3005327750.py, line 1)",
     "output_type": "error",
     "traceback": [
      "\u001b[1;36m  File \u001b[1;32m\"C:\\Users\\ADMINI~1\\AppData\\Local\\Temp/ipykernel_14840/3005327750.py\"\u001b[1;36m, line \u001b[1;32m1\u001b[0m\n\u001b[1;33m    a=\u001b[0m\n\u001b[1;37m      ^\u001b[0m\n\u001b[1;31mSyntaxError\u001b[0m\u001b[1;31m:\u001b[0m invalid syntax\n"
     ]
    }
   ],
   "source": [
    "a=\n",
    "b=\n",
    "c=b\n",
    "out(b)"
   ]
  }
 ],
 "metadata": {
  "interpreter": {
   "hash": "a6b2a446df440bee9c99ca0d62e47ab197710c7f47ecf8f74e850abc8bd383c6"
  },
  "kernelspec": {
   "display_name": "Python 3.9.7 ('base')",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.7"
  },
  "orig_nbformat": 4
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
